# 自定义存储类,重写URL方法


from django.core.files.storage import Storage
from django.utils.deconstruct import deconstructible


@deconstructible
class MyStorage(Storage):
    # def __init__(self, option=None):
    #     if not option:
    #         option = settings.CUSTOM_STORAGE_OPTIONS

    def _save(self, name, content, max_length=None):
        pass

    def _open(self, name, mode='rb'):
        pass

    def url(self, name):
        # name就是file_id
        return 'http://192.168.174.132:8888/' + name
